package com.example.multiple.config;

import com.example.multiple.properties.Test1DataSourceProperties;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

/**
 * @Author yanggld
 * @Date 2019/6/20-14:32
 * @Description
 */
@Component
public class TestDataSource1 {

	@Autowired
	private Test1DataSourceProperties test1DataSourceProperties;

	public DataSource dataSourceFTest1(){
		HikariDataSource dataSource = new HikariDataSource();
		dataSource.setDriverClassName(test1DataSourceProperties.getDriverClassName());
		dataSource.setJdbcUrl(test1DataSourceProperties.getUrl());
		dataSource.setUsername(test1DataSourceProperties.getUsername());
		dataSource.setPassword(test1DataSourceProperties.getPassword());
		return dataSource;
	}
}
